﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PBO.Game.BattleClass
{
    public partial class Battle
    {
        public Random _random { get; private set; }
        public int RandomSeed { private get; set; }

        public int GetRandomInt(int min, int max)
        {
            return min == max ? min : _random.Next(min, max + 1);
        }

        public double NextDouble()
        {
            return _random.NextDouble();
        }

        public int Next(int n)
        {
            return _random.Next(n);
        }

        public T GetRandom<T>(IEnumerable<T> array)
        {
            int count = array.Count();
            return array.ElementAt(_random.Next(count));
        }

        public bool RandomHappen(int percentage)
        {
            return _random.Next(100) < percentage;
        }

        public bool OneNth(int n)
        {
            return _random.Next(n) == 0;
        }
    }
}
